<template>
  <div class="user-info">
    <div class="container">
      <div class="user">
        <div class="avator" slot="reference">
          <img :src="getUserInfo.headimgurl" alt="" />
        </div>
        <div class="info">
          <div>{{ getUserInfo.nickname ?? getUserInfo.userName }}</div>
          <img src="@/assets/images/vip_03.png" class="vip" alt="">
        </div>
      </div>
      <div class="box">
        <div class="money">
          {{ $t('余额') }}：
          <span>{{ getUserInfo.pointsBalance }}</span>
        </div>
        <div class="topup" @click="$router.push('/withdrawal')">{{ $t('提现') }}</div>
      </div>
    </div>
  </div>
</template>

<script>
// import { replace, loginOutUser } from "@/utils";
import { mapGetters } from "vuex";
// import apiService from "@/api/apiService";
import storage from "store";
import appConfig from "@/config/appConfig";

export default {
  data() {
    return {
      language: '中文',
      user: null,
      login: true,
      searchNo: "",
      userBaseInfo: {
        userId: "USER1243",
        amount: 0,
      },
    };
  },
  created() {
    // getCurrentUser('header')
    this.user = storage.get(appConfig.ACCESS_TOKEN_NAME);
    if (this.user) {
      this.login = false;
    } else {
      this.login = true;
      // loginOutUser();
    }
  },
  computed: {
    ...mapGetters(["getUserInfo"]),

  },
  methods: {}

};
</script>

<style lang="scss" scoped>
.user-info {
  background-color: #f7ecd6;
  height: 120px;
  background-image: url('@/assets/images/user_money_03.png');
  background-repeat: no-repeat;
  background-size: auto 100%;
  background-position: right center;

  .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 30px;

    .user {
      display: flex;
      align-items: center;

      .avator {
        height: 60px;
        width: 60px;

        img {
          width: 100%;
          height: 100%;
        }
      }

      .info {
        padding-left: 20px;

        div {
          font-size: 18px;
          font-weight: bold;
        }

        img {
          width: 50px;
          margin-top: 4px;
        }
      }
    }

    .box {
      display: flex;
      align-items: center;

      .money {
        font-size: 18px;
        color: #bf8d5e;

        span {
          font-size: 24px;
        }
      }

      .topup {
        background-color: rgba(81, 194, 143, .8);
        margin-left: 40px;
        color: #fff;
        cursor: pointer;
        width: 100px;
        height: 40px;
        font-size: 16px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }
  }
}
</style>
